<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8" />
   
  <meta name="keywords" content="Java Python" />
   
  <meta name="description" content="From Zero to Hero" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  <title>
    JVM-08-监控和分析工具(可视化) |  朱酱酱的学习博客
  </title>
  <meta name="generator" content="hexo-theme-yilia-plus">
  
  <link rel="shortcut icon" href="/favicon.ico" />
  
  
<link rel="stylesheet" href="/css/style.css">

  
<script src="/js/pace.min.js"></script>


  

  

<link rel="alternate" href="/atom.xml" title="朱酱酱的学习博客" type="application/atom+xml">
</head>

</html>

<body>
  <div id="app">
    <main class="content">
      <section class="outer">
  <article id="post-JVM_Notes/JVM-08-监控和分析工具(可视化)" class="article article-type-post" itemscope
  itemprop="blogPost" data-scroll-reveal>

  <div class="article-inner">
    
    <header class="article-header">
       
<h1 class="article-title sea-center" style="border-left:0" itemprop="name">
  JVM-08-监控和分析工具(可视化)
</h1>
  

    </header>
    

    
    <div class="article-meta">
      <a href="/2020/02/06/JVM_Notes/JVM-08-%E7%9B%91%E6%8E%A7%E5%92%8C%E5%88%86%E6%9E%90%E5%B7%A5%E5%85%B7(%E5%8F%AF%E8%A7%86%E5%8C%96)/" class="article-date">
  <time datetime="2020-02-06T02:38:38.000Z" itemprop="datePublished">2020-02-06</time>
</a>
      
      
      
<div class="word_count">
    <span class="post-time">
        <span class="post-meta-item-icon">
            <i class="ri-quill-pen-line"></i>
            <span class="post-meta-item-text"> 字数统计:</span>
            <span class="post-count">1.6k字</span>
        </span>
    </span>

    <span class="post-time">
        &nbsp; | &nbsp;
        <span class="post-meta-item-icon">
            <i class="ri-book-open-line"></i>
            <span class="post-meta-item-text"> 阅读时长≈</span>
            <span class="post-count">6分钟</span>
        </span>
    </span>
</div>

      
    </div>
    

    
    
    <div class="tocbot"></div>





    

    <div class="article-entry" itemprop="articleBody">
      


      

      
      <h1 id="JVM-08-监控和分析工具-可视化"><a href="#JVM-08-监控和分析工具-可视化" class="headerlink" title="JVM-08-监控和分析工具(可视化)"></a>JVM-08-监控和分析工具(可视化)</h1><h2 id="前序"><a href="#前序" class="headerlink" title="前序"></a>前序</h2><p>上篇博客我们介绍了[虚拟机监控和分析命令行工具]，由于其不够直观，不是很容易排查问题，那么本篇博客我们就来介绍几个可视化工具。</p>
<h2 id="1-JConsole"><a href="#1-JConsole" class="headerlink" title="1. JConsole"></a>1. JConsole</h2><ul>
<li><p>JConsole（Java Monitoring and Management Console）是一款基于 JMX 的可视化监视和管理的工具。</p>
</li>
<li><p>它管理部分的功能是针对JMX MBean 进行管理，MBean可以使用代码，中间件服务器的管理控制台活着所有符合JMX规范的软件进行访问。</p>
</li>
</ul>
<h3 id="1-1-启动JConsole"><a href="#1-1-启动JConsole" class="headerlink" title="1.1 启动JConsole"></a>1.1 启动JConsole</h3><ul>
<li>这是我们<strong>JDK自带的监控工具</strong>，在JDK的安装目录bin下即可找到。</li>
<li>如果配置过JDK环境变量，在CMD命令提示符即可打开</li>
</ul>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/144733963.png" alt="mark"></p>
<p>这是一个可执行文件，直接双击即可打开。打开如下：</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/144844720.png" alt="mark"></p>
<h3 id="1-2-监控界面介绍"><a href="#1-2-监控界面介绍" class="headerlink" title="1.2 监控界面介绍"></a>1.2 监控界面介绍</h3><p>JConsole 这个监控工具可以监控本地进程以及远程进程，我们这里以监控本地进程为例，来介绍具体的监控界面。</p>
<p>点击本地进程下面的任意一栏，进入到监控界面。</p>
<ul>
<li><strong>监控概览</strong></li>
</ul>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/145028607.png" alt="mark"></p>
<p>这个界面是我们建立本地连接后，进入的第一个页面。显示的是整个虚拟机主要运行数据的概览，包括“堆使用情况”、“线程”、“类”、“CPU占用率”等四项信息的曲线图，这些曲线图是后面“内存”、“线程”、“类”页签的信息汇总，下面会分别介绍这几个页签。</p>
<ul>
<li><strong>内存监控</strong></li>
</ul>
<p>这个页面相当于上一篇介绍的jstat命令，只不过这里是可视化的，用于监控虚拟机内存的一些变化趋势.</p>
<p>监视区域如下：</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/145158638.png" alt="mark"></p>
<ul>
<li><strong>线程监控</strong></li>
</ul>
<p>这个页面标签相当于介绍的可视化的jstack命令，遇到线程停顿的时候可以使用这个页面标签进行监控分析。</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/145415085.png" alt="mark"></p>
<p>另外，此页面左下角还有一个检测死锁的按钮，出现线程死锁后，点击此按钮，便会出现一个新的死锁页签。</p>
<p>比如，对于如下这段死锁代码：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">Deadlock</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">            Object lock1 = <span class="keyword">new</span> Object();</span><br><span class="line">            Object lock2 = <span class="keyword">new</span> Object();</span><br><span class="line"></span><br><span class="line">            <span class="keyword">new</span> Thread(()-&gt;&#123;</span><br><span class="line">                <span class="keyword">synchronized</span> (lock1)&#123;</span><br><span class="line">                    <span class="keyword">try</span> &#123;</span><br><span class="line">                        Thread.sleep(<span class="number">1000</span>);</span><br><span class="line">                    &#125; <span class="keyword">catch</span> (InterruptedException e) &#123;</span><br><span class="line">                        e.printStackTrace();</span><br><span class="line">                    &#125;</span><br><span class="line">                    <span class="keyword">synchronized</span> (lock2)&#123;</span><br><span class="line">                        System.out.println(<span class="string">"线程1结束运行"</span>);</span><br><span class="line">                    &#125;</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;).start();</span><br><span class="line"></span><br><span class="line">            <span class="keyword">new</span> Thread(()-&gt;&#123;</span><br><span class="line">                <span class="keyword">synchronized</span> (lock2)&#123;</span><br><span class="line">                    <span class="keyword">try</span> &#123;</span><br><span class="line">                        Thread.sleep(<span class="number">1000</span>);</span><br><span class="line">                    &#125; <span class="keyword">catch</span> (InterruptedException e) &#123;</span><br><span class="line">                        e.printStackTrace();</span><br><span class="line">                    &#125;</span><br><span class="line">                    <span class="keyword">synchronized</span> (lock1)&#123;</span><br><span class="line">                        System.out.println(<span class="string">"线程2结束运行"</span>);</span><br><span class="line">                    &#125;</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;).start();</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<p>这里创建了两把锁，lock1,lock2，创建了两个线程，线程1获取到lock1后，说你给我lock2，我就释放lock1；而线程2获取到lock2后，说你给我lock1，我就释放lock2。两个线程谁也不释放，于是便造成了死锁现象。</p>
<p>通过监控工具便可以检查到，如下：</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/150111966.png" alt="mark"></p>
<ul>
<li>类监控</li>
</ul>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/150146700.png" alt="mark"></p>
<ul>
<li>VM概要</li>
</ul>
<p>展示一些JVM信息。</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/150235776.png" alt="mark"></p>
<h3 id="1-3-配置Tomcat远程监控"><a href="#1-3-配置Tomcat远程监控" class="headerlink" title="1.3 配置Tomcat远程监控"></a>1.3 配置Tomcat远程监控</h3><p>其实使用监控工具，我们很少对本地的程序进行监控，大多数情况都是对部署在远程Linux服务器上的程序进行监控，那么想要使用 JConsole这款工具进行远程监控，我们必须要进行一些配置。我们首先介绍对Tomcat的远程监控。</p>
<ol>
<li><strong>配置catalina.sh</strong></li>
</ol>
<p>在该文件下加入如下配置信息：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">JAVA_OPTS=<span class="string">"$JAVA_OPTS -Djava.rmi.server.hostname=192.168.146.200 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"</span></span><br></pre></td></tr></table></figure>

<p>　-Dcom.sun.management.jmxremote 表示开启远程连接。</p>
<p>　-Dcom.sun.management.jmxremote.port=1099 表示设置远程连接端口为1099</p>
<p>　-Dcom.sun.management.jmxremote.authenticate=false 表示不需要密码验证</p>
<p>　-Dcom.sun.management.jmxremote.ssl=fals 表示不需要开启ssl连接</p>
<p>　-Djava.net.preferIPv4Stack=true 表示只支持IPV4地址</p>
<p>　-Djava.rmi.server.hostname=192.168.146.200 表示监控的主机名为192.168.146.200</p>
<p>添加位置如下：</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/150754763.png" alt="mark"></p>
<ol start="2">
<li><strong>建立连接</strong></li>
</ol>
<p>通过上面的配置，启动Tomcat后，我们只需要在 JConsole 的远程连接界面，输入 192.168.146.200:1099，然后点击连接即可</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/151023591.png" alt="mark"></p>
<ol start="3">
<li><strong>连接错误</strong></li>
</ol>
<ul>
<li><p>配置的端口不能被占用，可以通过 netstat -tunlp|grep 1099 命令验证。</p>
</li>
<li><p>云服务器的端口有没有添加安全组</p>
</li>
<li><p>通过 hostname -i 命令，如果打印的不是前面设置的ip地址，则需要通过 vim /etc/hosts 命令，将127.0.0.1 修改为本机IP地址。</p>
</li>
</ul>
<h3 id="1-4-配置远程jar包监控"><a href="#1-4-配置远程jar包监控" class="headerlink" title="1.4 配置远程jar包监控"></a>1.4 配置远程jar包监控</h3><p>启动jar包的命令如下：</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">nohup java -Djava.rmi.server.hostname=<span class="number">192.168</span><span class="number">.146</span><span class="number">.200</span> -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=<span class="number">1089</span> -Dcom.sun.management.jmxremote.authenticate=<span class="keyword">false</span> -Dcom.sun.management.jmxremote.ssl=<span class="keyword">false</span> -jar jvm-<span class="number">0.0</span><span class="number">.1</span>-SNAPSHOT.jar &amp;</span><br></pre></td></tr></table></figure>

<p>配置端口，ip地址，和远程监控Tomcat大体上是一样的，然后建立连接即可。</p>
<h2 id="2-JVisualVM"><a href="#2-JVisualVM" class="headerlink" title="2. JVisualVM"></a>2. JVisualVM</h2><p>英文介绍为 All-in-One Java Troubleshooting Tool。听名字我们就知道这是一块功能很全，很强大的Java运行监视和故障处理工具，并且是官方主力发展的虚拟机故障处理工具，其性能分析比很多专业收费软件都不会逊色多少。</p>
<h3 id="2-1-启动JVisualVM"><a href="#2-1-启动JVisualVM" class="headerlink" title="2.1 启动JVisualVM"></a>2.1 启动JVisualVM</h3><p>和前面介绍的JConsole工具一样，这也是 JDK 自带的一个工具，在安装目录bin下，可以直接双击启动。</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/151328222.png" alt="mark"></p>
<p>打开界面如下：</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/151357191.png" alt="mark"></p>
<h3 id="2-2-监控界面介绍"><a href="#2-2-监控界面介绍" class="headerlink" title="2.2 监控界面介绍"></a>2.2 监控界面介绍</h3><p>其实大体界面和JConsole差不多。</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/151508736.png" alt="mark"></p>
<ul>
<li><strong>抽样器：可以对CPU，内存进行详细监控统计</strong></li>
</ul>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/151549899.png" alt="mark"></p>
<ul>
<li><strong>插件机制</strong></li>
</ul>
<p>JVisualVM 比较强大的地方在与可以安装各种插件，提供各种不同的功能。</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/151628412.png" alt="mark"></p>
<p>然后设置插件中心的地址：</p>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">https:&#x2F;&#x2F;visualvm.github.io&#x2F;pluginscenters.html</span><br></pre></td></tr></table></figure>

<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/151832592.png" alt="mark"></p>
<p>选择对应的插件地址时，要根据我们的JDK版本来选定。</p>
<p>比如，我这边的JDK版本如下：</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/151920811.png" alt="mark"></p>
<p>插件会遇到的问题解决方案： <a href="https://blog.csdn.net/xionglangs/article/details/77603343" target="_blank" rel="noopener">https://blog.csdn.net/xionglangs/article/details/77603343</a></p>
<p>设置好下载地址后，<strong>我们这边选择需要的插件，点击安装即可！比如比较常用的插件 Visual GC(用来查看GC日志)</strong></p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/151958195.png" alt="mark"></p>
<p>安装完成之后，我们便可以在页签上看到这个新增的插件。</p>
<p><img src="http://zhuuu-bucket.oss-cn-beijing.aliyuncs.com/img/20200525/152015784.png" alt="mark"></p>
<h3 id="2-3-配置远程连接"><a href="#2-3-配置远程连接" class="headerlink" title="2.3 配置远程连接"></a>2.3 配置远程连接</h3><p>不管是远程连接Tomcat还是jar包，都和介绍JConsole一模一样，详情请参考上面的配置。</p>
<h3 id="2-4-使用文档"><a href="#2-4-使用文档" class="headerlink" title="2.4 使用文档"></a>2.4 使用文档</h3><p>对于JVisualvm，官方有详细的中文文档说明，如下：</p>
<p><a href="https://visualvm.github.io/documentation.html" target="_blank" rel="noopener">https://visualvm.github.io/documentation.html</a></p>

      
      <!-- reward -->
      
      <div id="reward-btn">
        打赏
      </div>
      
    </div>
      <!-- copyright -->
      
        <div class="declare">
          <ul class="post-copyright">
            <li>
              <i class="ri-copyright-line"></i>
              <strong>版权声明： </strong s>
              本博客所有文章除特别声明外，均采用 <a href="https://www.apache.org/licenses/LICENSE-2.0.html" rel="external nofollow"
                target="_blank">Apache License 2.0</a> 许可协议。转载请注明出处！
            </li>
          </ul>
        </div>
        
    <footer class="article-footer">
      
          
<div class="share-btn">
      <span class="share-sns share-outer">
        <i class="ri-share-forward-line"></i>
        分享
      </span>
      <div class="share-wrap">
        <i class="arrow"></i>
        <div class="share-icons">
          
          <a class="weibo share-sns" href="javascript:;" data-type="weibo">
            <i class="ri-weibo-fill"></i>
          </a>
          <a class="weixin share-sns wxFab" href="javascript:;" data-type="weixin">
            <i class="ri-wechat-fill"></i>
          </a>
          <a class="qq share-sns" href="javascript:;" data-type="qq">
            <i class="ri-qq-fill"></i>
          </a>
          <a class="douban share-sns" href="javascript:;" data-type="douban">
            <i class="ri-douban-line"></i>
          </a>
          <!-- <a class="qzone share-sns" href="javascript:;" data-type="qzone">
            <i class="icon icon-qzone"></i>
          </a> -->
          
          <a class="facebook share-sns" href="javascript:;" data-type="facebook">
            <i class="ri-facebook-circle-fill"></i>
          </a>
          <a class="twitter share-sns" href="javascript:;" data-type="twitter">
            <i class="ri-twitter-fill"></i>
          </a>
          <a class="google share-sns" href="javascript:;" data-type="google">
            <i class="ri-google-fill"></i>
          </a>
        </div>
      </div>
</div>

<div class="wx-share-modal">
    <a class="modal-close" href="javascript:;"><i class="ri-close-circle-line"></i></a>
    <p>扫一扫，分享到微信</p>
    <div class="wx-qrcode">
      <img src="//api.qrserver.com/v1/create-qr-code/?size=150x150&data=http://zhuuu.work/2020/02/06/JVM_Notes/JVM-08-%E7%9B%91%E6%8E%A7%E5%92%8C%E5%88%86%E6%9E%90%E5%B7%A5%E5%85%B7(%E5%8F%AF%E8%A7%86%E5%8C%96)/" alt="微信分享二维码">
    </div>
</div>

<div id="share-mask"></div>
      
      
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/JVM/" rel="tag">JVM</a></li><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/%E8%AF%BB%E4%B9%A6%E7%AC%94%E8%AE%B0/" rel="tag">读书笔记</a></li></ul>


    </footer>

  </div>

  
  
  <nav class="article-nav">
    
      <a href="/2020/02/08/config/IDEA-%E9%85%8D%E7%BD%AE%E4%BC%98%E5%8C%96/" class="article-nav-link">
        <strong class="article-nav-caption">上一篇</strong>
        <div class="article-nav-title">
          
            IDEA:配置优化
          
        </div>
      </a>
    
    
      <a href="/2020/02/05/JVM_Notes/JVM-07-%E7%9B%91%E6%8E%A7%E5%92%8C%E5%88%86%E6%9E%90%E5%B7%A5%E5%85%B7(%E5%91%BD%E4%BB%A4%E8%A1%8C)/" class="article-nav-link">
        <strong class="article-nav-caption">下一篇</strong>
        <div class="article-nav-title">JVM-07-监控和分析工具(命令行)</div>
      </a>
    
  </nav>


  

  
  
<!-- valine评论 -->
<div id="vcomments-box">
    <div id="vcomments">
    </div>
</div>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src='https://cdn.jsdelivr.net/npm/valine@1.3.10/dist/Valine.min.js'></script>
<script>
    new Valine({
        el: '#vcomments',
        notify: false,
        verify: '',
        app_id: '',
        app_key: '',
        path: window.location.pathname,
        avatar: 'mp',
        placeholder: '给我的文章加点评论吧~',
        recordIP: true
    });
    const infoEle = document.querySelector('#vcomments .info');
    if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
        infoEle.childNodes.forEach(function (item) {
            item.parentNode.removeChild(item);
        });
    }
</script>
<style>
    #vcomments-box {
        padding: 5px 30px;
    }

    @media screen and (max-width: 800px) {
        #vcomments-box {
            padding: 5px 0px;
        }
    }

    #vcomments-box #vcomments {
        background-color: #fff;
    }

    .v .vlist .vcard .vh {
        padding-right: 20px;
    }

    .v .vlist .vcard {
        padding-left: 10px;
    }
</style>

  

  
  
<div class="gitalk" id="gitalk-container"></div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1.5.0/dist/gitalk.css">


<script src="https://cdn.jsdelivr.net/npm/gitalk@1.5.0/dist/gitalk.min.js"></script>


<script src="https://cdn.jsdelivr.net/npm/blueimp-md5@2.10.0/js/md5.min.js"></script>

<script type="text/javascript">
  var gitalk = new Gitalk({
    clientID: 'db188ed8c86dc4b0dbf3',
    clientSecret: 'a58f92160e5a9efd726b7d533000a0737f3e3f3e',
    repo: 'Blog-comments',
    owner: 'Zhuuuuuuuu',
    admin: ['Zhuuuuuuuu'],
    // id: location.pathname,      // Ensure uniqueness and length less than 50
    id: md5(location.pathname),
    distractionFreeMode: false,  // Facebook-like distraction free mode
    pagerDirection: 'last'
  })

  gitalk.render('gitalk-container')
</script>

  

</article>
</section>
      <footer class="footer">
  <div class="outer">
    <ul class="list-inline">
      <li>
        &copy;
        2019-2021
        Zhuuu
      </li>
      <li>
        
      </li>
    </ul>
    <ul class="list-inline">
      <li>
        
        
        <span>
  <i>PV:<span id="busuanzi_value_page_pv"></span></i>
  <i>UV:<span id="busuanzi_value_site_uv"></span></i>
</span>
        
      </li>
      <li>
        <!-- cnzz统计 -->
        
        <script type="text/javascript" src='https://s9.cnzz.com/z_stat.php?id=1278069914&amp;web_id=1278069914'></script>
        
      </li>
    </ul>
  </div>
</footer>
    <div class="to_top">
        <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>
      </div>
    </main>
      <aside class="sidebar">
        <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/"><img src="/images/ayer-side.svg" alt="朱酱酱的学习博客"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/">主页</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags">标签</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/JVM/">JVM</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/JDK%E6%BA%90%E7%A0%81%E5%88%86%E6%9E%90/">JDK源码</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/%E5%A4%9A%E7%BA%BF%E7%A8%8B/">多线程</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/Mysql/">Mysql</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/Redis/">Redis</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/%E8%AE%BE%E8%AE%A1%E8%80%85%E6%A8%A1%E5%BC%8F/">设计模式</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/MyBatis/">MyBatis</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/SpringMVC/">SpringMVC</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/Spring/">Spring</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/SpringBoot/">SpringBoot</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/%E6%93%8D%E4%BD%9C%E7%B3%BB%E7%BB%9F/">Linux</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/Leetcode/">Leetcode</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/%E5%89%8D%E7%AB%AF/">前端</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/%E7%BD%91%E7%BB%9C%E7%BC%96%E7%A8%8B/">网络编程</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/photoshop/">photoshop</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="http://smartzhuuu.lofter.com/" target="_blank" rel="noopener">摄影</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/2020/about">关于我</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      <a class="nav-item-link nav-item-search"  title="Search">
        <i class="ri-search-line"></i>
      </a>
      
      
      <a class="nav-item-link" target="_blank" href="/atom.xml" title="RSS Feed">
        <i class="ri-rss-line"></i>
      </a>
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
      </aside>
      <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i>请我喝杯咖啡吧~</p>
  <div class="reward-box">
    
    <div class="reward-item">
      <img class="reward-img" src="/images/alipay.jpg">
      <span class="reward-type">支付宝</span>
    </div>
    
    
    <div class="reward-item">
      <img class="reward-img" src="/images/wechat.jpg">
      <span class="reward-type">微信</span>
    </div>
    
  </div>
</div>
      
<script src="/js/jquery-2.0.3.min.js"></script>


<script src="/js/jquery.justifiedGallery.min.js"></script>


<script src="/js/lazyload.min.js"></script>


<script src="/js/busuanzi-2.3.pure.min.js"></script>


<script src="/js/share.js"></script>



<script src="/fancybox/jquery.fancybox.min.js"></script>




<script>
  try {
    var typed = new Typed("#subtitle", {
    strings: ['昨夜西风凋碧树。独上高楼，望尽天涯路','衣带渐宽终不悔，为伊消得人憔悴。','众里寻他千百度。蓦然回首，那人却在，灯火阑珊处。'],
    startDelay: 0,
    typeSpeed: 200,
    loop: true,
    backSpeed: 100,
    showCursor: true
    });
  } catch (err) {
  }
  
</script>




<script src="/js/tocbot.min.js"></script>

<script>
  // Tocbot_v4.7.0  http://tscanlin.github.io/tocbot/
  tocbot.init({
    tocSelector: '.tocbot',
    contentSelector: '.article-entry',
    headingSelector: 'h1, h2, h3, h4, h5, h6',
    hasInnerContainers: true,
    scrollSmooth: true,
    scrollContainer:'main',
    positionFixedSelector: '.tocbot',
    positionFixedClass: 'is-position-fixed',
    fixedSidebarOffset: 'auto',
    onClick: (e) => {
      $('.toc-link').removeClass('is-active-link');
      $(`a[href=${e.target.hash}]`).addClass('is-active-link');
      $(e.target.hash).scrollIntoView();
      return false;
    }
  });
</script>


<script>
  var ayerConfig = {
    mathjax: true
  }
</script>


<script src="/js/ayer.js"></script>


<script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css">


<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.css">
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>

<script>
    function viewer_init() {
        let pswpElement = document.querySelectorAll('.pswp')[0];
        let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))

        $imgArr.forEach(($em, i) => {
            $em.onclick = () => {
                // slider展开状态
                // todo: 这样不好，后面改成状态
                if (document.querySelector('.left-col.show')) return
                let items = []
                $imgArr.forEach(($em2, i2) => {
                    let img = $em2.getAttribute('data-idx', i2)
                    let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
                    let title = $em2.getAttribute('alt')
                    // 获得原图尺寸
                    const image = new Image()
                    image.src = src
                    items.push({
                        src: src,
                        w: image.width || $em2.width,
                        h: image.height || $em2.height,
                        title: title
                    })
                })
                var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
                    index: parseInt(i)
                });
                gallery.init()
            }
        })
    }
    viewer_init()
</script>



<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
      tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
      }
  });

  MathJax.Hub.Queue(function() {
      var all = MathJax.Hub.getAllJax(), i;
      for(i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
      }
  });
</script>

<script src="https://cdn.jsdelivr.net/npm/mathjax@2.7.6/unpacked/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>


<script type="text/javascript" src="https://js.users.51.la/20544303.js"></script>
  </div>
</body>

</html>